var express = require('express');
var router = express.Router();
var fs = require('fs');

/* GET home page. */

router.get('/', function(req, res, next) {
  res.redirect('/juniors/section01part01');
});

router.get('/:section', function(req, res, next) {
  res.render('junior/' + req.params.section);
});

router.get('/models/vtk/:vtkfile', function(req, res, next) {
  fs.readFile('public/bower_components/three/examples/models/vtk/' + req.params.vtkfile, 'utf8', function(err, data){
  	if(err) {
  		console.log(err)
  	}
    res.send(data);
  })
});

module.exports = router;
